package sctu.edu.java.year2016.team08.lisonghong.day20160616.chapter15_1;

/**
 * Created by 松红 on 2016/6/17.
 * 在控制台输出一段话，以0.1秒的速度递增。
 */
public class RunThread extends Thread {

    Thread thread;

    public RunThread() {
        thread = new Thread(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    try {
                        System.out.println("以0.1秒的速度递增！");
                        thread.sleep(100);
                        System.out.println("前方有浩瀚星光，听说道阻且长！");
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
        thread.start();

    }

    public static void main(String[] args) {
        new RunThread();
    }
}
